fix: use epoch fallback for entity lastModifiedTime#265
Merged
YunchuWang merged 2 commits intoJun 12, 2026
Conversation
convertEntityMetadata() used new Date() (current time) as the default when the proto lastModifiedTime field was missing. This is inconsistent with _createOrchestrationStateFromProto(), which uses new Date(0) (Unix epoch) for missing timestamps. The current-time default makes it impossible for callers to distinguish between 'entity was just modified' and 'entity has no known modification time'. Changed the default to new Date(0) for consistency and correctness. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
6c76e42 to
f6be3fa
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes entity metadata timestamp conversion so missing lastModifiedTime values default to the Unix epoch (new Date(0)) instead of the current time, aligning entity behavior with existing orchestration timestamp defaults and preventing misleading “just modified” timestamps from appearing in client results.
Changes:
- Updated
TaskHubGrpcClient.convertEntityMetadata()to use an epoch fallback for missinglastModifiedTime. - Added tests intended to cover the epoch fallback and “timestamp present” behavior for entity metadata conversion.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/durabletask-js/src/client/client.ts | Changes the lastModifiedTime fallback to new Date(0) when the proto field is absent. |
| packages/durabletask-js/test/entity-client.spec.ts | Adds new test cases around missing/present lastModifiedTime handling (currently re-implementing the logic rather than exercising production conversion). |
Update entity metadata timestamp tests to call TaskHubGrpcClient.convertEntityMetadata instead of duplicating the fallback expression in the test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
kaibocai
approved these changes
Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #240